<template>
  <div class="home">
    <h3>发送数据给主应用</h3>
    <div class="input-box">
      <el-input placeholder="请输入内容" v-model="input" clearable>
        <template slot="prepend">数据：</template>
      </el-input>
      <el-button type="primary" @click="btn">发送</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      input: ""
    };
  },
  methods: {
    btn() {
      if (window.__POWERED_BY_QIANKUN__) {
        if (this.input.trim() == "") {
          this.open3()
        } else {
          this.changeDataMsg(this.input);
        }
      } else {
        alert("独立运行不能发送给数据");
      }
      //   const {href} =  this.$router.resolve({path:'/about'})
      //   window.open(href,'_blank')
    },
    open3() {
      this.$message({
        message: "不能发送空内容",
        type: "warning"
      });
    }
  }
};
</script>

<style  scoped>
.home {
  text-align: center;
  line-height: 50px;
}
.input-box {
  width: 40%;
  margin: 0 auto;
}
</style>